home *** CD-ROM | disk | FTP | other *** search
- /** SCPMouse.rexx
- *
- * Example of how to receive mouse move messages from VLT and to
- * send arrow keys to the host. This version is designed for use
- * with the SLAC SCP program, where each horizontal arrow moves
- * the "cursor" by 10 spaces, and each vertical arrow moves it by
- * 4 lines. There is also room at the bottom, etc. to take into
- * account.
- *
- * Willy langeveld, version March 1992.
- *
- **/
- parse arg vltport .
- address value vltport
-
- quitflag = 0
-
- if showlist('p', vltport'SCPMOUSE') = 1 then exit
-
- mp = openport(vltport'SCPMOUSE')
-
- do forever
- if quitflag = 1 then leave
- t = waitpkt(vltport'SCPMOUSE')
- do forever
- p = getpkt(vltport'SCPMOUSE')
- if c2d(p) = 0 then leave
-
- string = getarg(p)
- t = reply(p, 0)
-
- parse var string xx yy ytot
- yy = yy - (ytot - 28)
- if yy < 0 then iterate
- if yy > 24 then iterate
-
- newx = (xx) % 10
- newy = (yy) % 3
- /*
- * Cursor home
- */
- send "(*E[4~)"
- /*
- * Move in X. either from first to the right...
- */
- if newx < 4 then do
- send "(*E[C)"
- if newx < 8 & newx > -1 then do
- do i = 1 to newx
- send "(*E[C)"
- end
- end
- end
- /*
- * ...or from home backwards
- */
- else do
- newx = 7 - newx
- if newx < 8 & newx > -1 then do
- do i = 1 to newx
- send "(*E[D)"
- end
- end
- end
- /*
- * Move in Y. Either from home down...
- */
- if newy < 4 then do
- if newy < 8 & newy > -1 then do
- do i = 1 to newy
- send "(*E[B)"
- end
- end
- end
- /*
- * ...or from bottom up.
- */
- else do
- send "(*E[A)"
- newy = 7 - newy
- if newy < 8 & newy > -1 then do
- do i = 1 to newy
- send "(*E[A)"
- end
- end
- end
- /*
- * Send enter key
- */
- "delay .3; send (*EOM)"
- end
- end
-
- /* This example doesn't really ever: */
- exit
-
-